package com.zzyl.task;

import com.zzyl.service.AlertRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @className: ALarmTask
 * @description:
 * @author: 国民老公陈先生
 * @date: 2024/6/17 20:47
 * @Version: 1.0
 */
@Slf4j
@Component
public class ALarmTask {
    @Autowired
    private AlertRuleService alertRuleService;

    /**
     * 每分钟执行一次
     */
    @Scheduled(cron = "0 * * * * ?")// 设置定时任务的时间
    public void ALarmTask() {
        log.info("报警任务开始");
        alertRuleService.alarmAction();
        log.info("报警任务结束");
    }
}
